<template>
  <div class="container">
    <div class="centerNav">
      <ul>
        <li class="first">全部</li>
        <li>日系插画</li>
        <li>古风插画</li>
        <li>游戏原画</li>
        <li>概念设计</li>
        <li>商业插画</li>
        <li>纸绘</li>
        <li>插画绘画</li>
        <li>设计</li>
        <li>模型</li>
        <li>动画</li>
      </ul>
    </div>
    <div class="centerBox">
      <div class="center">
        <div class="course-list" v-for="item in data" :key="item.courseId">
          <div class="imgBox" @click="clicked(item.courseId)">
            <img :src="item.courseImg" alt="" />
          </div>
          <div class="info">
            <h3 class="courseName" @click="clicked(item.courseId)">
              <span>
                <img
                  src="https://assets-cdn.lanqb.com/school_v5/school/procourse-icon.png"
                  alt=""
                />专业课
              </span>
              {{ item.courseName }}
            </h3>

            <p class="studyTime">
              <span>学习周期 : {{ item.courseTime }}</span>
              <span>
                <em class="red">{{ item.likePerson }}</em>
                人感兴趣
              </span>
            </p>
            <div class="teasBox">
              <p>主讲老师</p>
              <div class="teachers">
                <div class="teasImg">
                  <span @click="todaka(item.xuehao)">
                    <img :src="item.teacherImg" alt="" />
                  </span>
                </div>
                <div class="teasName">
                  <a href="">
                    <p>{{ item.teacherName }}<span></span></p>
                  </a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      data: "",
    };
  },
  methods: {
    clicked(id) {
      //  console.log(id);
      this.$router.push({ path: `/courseDetail/${id}` });
    },
    todaka(xuehao) {
      this.$router.push({
        name: "wodeceshi",
        query: { xuehao },
      });
    },
  },
  components: {},
  mounted() {
    console.log(1111);
    this.axios.get("/find").then((res) => {
      console.log(res.data);
      this.data = res.data;
    });
  },
};
</script>
<style lang="scss" scoped>
.container {
  background-color: white;
}
.centerNav {
  width: 1180px;
  height: 62px;
  position: relative;
  background-color: #f6f8fa;
  margin: 0 auto;
  margin-top: 20px;
  border-radius: 6px;

  ul {
    display: flex;
    height: 32px;
    line-height: 32px;
    position: absolute;
    top: 16px;
    left: 32px;

    li:not(.first) {
      list-style: none;
      font-size: 15px;
      color: #525a67;
      margin-right: 52px;
      cursor: pointer;
    }
    .first {
      padding: 0 10px;
      height: 32px;
      background: #027cdb;
      color: #ffffff;
      border-radius: 6px;
      margin-right: 42px;
    }
  }
}
.centerBox {
  width: 1180px;
  margin: 20px auto;
}
.center {
  width: 1200px;
  margin: 20px auto;
  margin-right: -20px;
  display: flex;
  flex-wrap: wrap;
}
.course-list {
  width: 280px;
  height: 352px;
  background-color: #f6f8fa;
  position: relative;
  margin-top: 20px;
  margin-right: 20px;
  border-radius: 6px;
  &:hover {
    box-shadow: -5px 5px 20px -2px rgb(233, 232, 232),
      5px 5px 20px -2px rgb(233, 232, 232);
  }

  .imgBox {
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    img {
      object-fit: cover;
      width: 100%;
      height: 100%;
      transition: all 0.8s;
      &:hover {
        transform: scale(1.1);
      }
    }
  }
}
.info {
  padding: 10px;
  box-sizing: border-box;
  border-radius: 0 0 6px 6px;

  // a {
  //   text-decoration: none;
  //   display: block;
  // }
}

.courseName {
  font-size: 16px;
  color: #212b34;
  font-weight: bold;
  line-height: 23px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 10px;
  cursor: default;

  span {
    font-weight: normal;
    height: 23px;
    line-height: 23px;
    padding: 3px 5px;
    color: #ffffff;
    font-size: 12px;
    background: #212b34;
    border-radius: 6px;
    margin-right: 4px;

    img {
      width: 10px;
      height: 13px;
      margin-right: 4px;
      vertical-align: middle;
    }
  }
}

.studyTime {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #87959f;
  font-size: 12px;
  cursor: default;

  em {
    font-style: normal;
    color: #ff5900;
    font-size: 12px;
  }
}

.teasBox {
  background-color: white;
  border-radius: 6px;
  padding: 6px 10px 10px;
  margin-top: 8px;
  box-sizing: border-box;

  p {
    padding-bottom: 6px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color: #525a67;
    border-bottom: 1px solid #f6f8fa;
  }
}

.teachers {
  display: flex;
  height: 40px;

  a {
    display: block;
    text-decoration: none;
  }
}
.teasImg {
  span {
    display: inline-block;
    margin-right: 10px;
    width: 40px;
    height: 40px;
  }
  img {
    overflow: hidden;
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }
}

.teasName a p {
  color: black;
  font-size: 17px;
  line-height: 40px;
  margin-left: 10px;

  span {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url(https://assets-cdn.lanqb.com/pc_users/identity-icon_coo.png)
      no-repeat 50%;
    background-size: 100% 100%;
  }
}
</style>